package com.cbd.config;

import cn.dev33.satoken.interceptor.SaInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: CBD
 * @Date: 2024/11/15 15:39
 * @Description:注册Sa-Token注解拦截器，打开注解式鉴权功能
 */
@Configuration
public class SaTokenConfig implements WebMvcConfigurer {
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册Sa-Token的注解拦截器，打开注解式鉴权功能
        registry.addInterceptor(new SaInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login", "/logout");
    }
}
